package com.gitee.ribbon.config;

import com.gitee.ribbon.interceptor.MyLoadBalanced;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
import org.springframework.cloud.client.loadbalancer.LoadBalancerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

import java.util.Collections;

@Configuration
public class RestConfig {

    @Autowired
    private LoadBalancerClient loadBalancer;

    @Bean
    @MyLoadBalanced
    public RestTemplate getRestTemplate() {
        //return new RestTemplate();
        RestTemplate restTemplate = new RestTemplate();
        return restTemplate;
    }
}
